package logic

import (
	"context"
	"wechats/model/mysql"

	"wechats/wechatrpc/internal/svc"
	"wechats/wechatrpc/wechatrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type MomentShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewMomentShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MomentShowLogic {
	return &MomentShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *MomentShowLogic) MomentShow(in *wechatrpc.MomentShowRequest) (*wechatrpc.MomentShowResponse, error) {
	// todo: add your logic here and delete this line

	var personal mysql.Personal
	mysql.DB.Debug().Where("id=?", in.Id).Find(&personal)
	return &wechatrpc.MomentShowResponse{
		Id:      int64(personal.ID),
		Image:   personal.Image,
		Name:    personal.Name,
		Hao:     personal.Hao,
		Address: personal.Address,
	}, nil
}
